import { createStore, createLogger } from 'vuex'
import setting from '@/store/modules/setting'
import permission from '@/store/modules/permission'

import normalData from '@/store/modules/normalData'
import operateData from '@/store/modules/operateData'
const debug = process.env.NODE_ENV === 'development'
const plugins = debug ? [createLogger({})] : []

export const store = createStore({
  plugins,
  modules: {
    setting,
    permission,
    normalData,
    operateData
  }
})

export function useStore() {
  return store
}
